<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        width: 500px;
        height: 400px;
        border: 1px solid #000;
        margin: 50px auto;
        position: relative;
      }
      section {
        width: 30px;
        height: 100px;
        position: absolute;
        transition: 1s;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        transform-origin: 50% 100%;
      }
      section:first-child {
        background-color: red;
      }
      div:hover section:first-child {
        transform: translate(-50%, -50%) rotate(90deg);
      }
      section:nth-child(2) {
        background-color: orange;
      }
      div:hover section:nth-child(2) {
        transform: translate(-50%, -50%) rotate(75deg);
      }
      section:nth-child(3) {
        background-color: yellow;
      }
      div:hover section:nth-child(3) {
        transform: translate(-50%, -50%) rotate(60deg);
      }
      section:nth-child(4) {
        background-color: green;
      }
      div:hover section:nth-child(4) {
        transform: translate(-50%, -50%) rotate(45deg);
      }
      section:nth-child(5) {
        background-color: cyan;
      }
      div:hover section:nth-child(5) {
        transform: translate(-50%, -50%) rotate(30deg);
      }
    </style>
  </head>
  <body>
    <div>
      <section></section>
      <section></section>
      <section></section>
      <section></section>
      <section></section>
    </div>
  </body>
</html>
